Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapted rej_eyecontin.m to work on epoched data #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dyschezia
Copy link

The code works the same, but now initially loops over epochs when searching for bad_ET intervals and when adding the additional windowsize samples (to not cause spill between epochs). Can return a similar seq_bad struct with an additional 'epoch' column, or a third output that contains seq_bad like structures per epoch. Will not reject bad data from epoched data. An additional small change in rejectionmethod == 2: code checks if bad_ET events already exist in EEG.event (e.g., from running the function previously on the continuous data) and if so, removes them. Also removed line calculating duration, as it is already calculated by findsequence2.m.

The code works the same, but now initially loops over epochs when searching for bad_ET intervals and when adding the additional windowsize samples (to not cause spill between epochs). Can return a similar seq_bad struct with an additional 'epoch' column, or a third output that contains seq_bad like structures per epoch. Will not reject bad data from epoched data.
EEG = pop_select(EEG,'nopoint',seq_bad_overall(:,1:2));
else
error('%s(): Attempting to remove bad intervals from epoched data', mfilename)
end
case 2 % add "bad_ET" marker for each bad interval

% Update march 2018 (OD)
% Do not remove data, but introduce new bad_ET events in EEG.event
fprintf('\nAdding %i bad_ET markers to the EEG.event structure...\nNot removing any data.\n\n',size(seq_bad,1))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seq_bad needs to be changed to seq_bad_overall. Sorry for missing that.

@olafdimigen
Copy link
Owner

fantastic! (I will need a few days to find time to look into this and to merge)

@Dyschezia
Copy link
Author

I now noticed that in detecteyemovement.m, if there are epochs with no good samples at all, and the SD threshold is computed over all epochs, the mean of the msdx/msdy over epochs is NaN. This happens because the msdx/y for that epoch is NaN and then the mean is computed over values, which have a NaN in them. This can be solved by computing the mean while ignoring NaNs, but I'm not confident enough in my understanding of the plugin and possible dependencies within it to suggest more changes. Maybe lmk what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants